Protecting parallel multiplication operations from external monitoring attacks

ABSTRACT

Systems and methods for protecting from external monitoring attacks cryptographic data processing operations involving universal polynomial hash functions computation. An example method may comprise: receiving an input data block and an iteration result value; performing a first field multiplication operation to produce a new iteration result value, by iteratively processing, starting from a first bit position, bits of a combination of the input data block and the iteration result value, wherein the first bit position is represented by one of: a least-significant bit and a most-significant bit; performing a second field multiplication operation to produce a new mask correction value, by iteratively processing operand bits starting from a second bit position, wherein the second bit position is represented by one of: a least-significant bit and a most-significant bit, and wherein the second bit position is different from the first bit position; applying the new mask correction value to the new iteration result value; and producing, based on the new iteration result value, a value of a cryptographic hash function to be utilized by at least one of: an authenticated encryption operation or an authenticated decryption operation.

RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No. 16/471,716 filed on Jun. 20, 2019, which is the U.S. national stage under 35 U.S.C. § 371 of International Application No. PCT/US17/66052, filed on Dec. 13, 2017, which claims the benefit of U.S. Provisional Application No. 62/437,396, filed on Dec. 21, 2016. The entire contents of the above-referenced applications are incorporated by reference herein.

TECHNICAL FIELD

The present disclosure is generally related to computer systems, and is more specifically related to cryptographic data processing systems and methods.

BACKGROUND

Since the advent of computers, constantly evolving have been not only various systems and methods for safeguarding cryptographic keys and/or other sensitive data, but also systems and methods for gaining unauthorized access to the protected data, ranging from conceptually unsophisticated brute force password cracking to complex external monitoring attacks.

BRIEF DESCRIPTION OF THE DRAWINGS

The present disclosure is illustrated by way of examples, and not by way of limitation, and may be more fully understood with references to the following detailed description when considered in connection with the figures, in which:

FIG. 1 schematically illustrates an example circuit for computing an unmasked universal polynomial hash function, such as GHASH function, in accordance with one or more aspects of the present disclosure;

FIG. 2 schematically illustrates an example circuit for computing a universal polynomial hash function, such as GHASH function, in a manner resistant to external monitoring attacks, by iteratively processing the operand bits starting from the first block of the input data, by masking the first input data block, and re-using the corresponding mask correction value as the mask in the subsequent iterations, in accordance with one or more aspects of the present disclosure;

FIG. 3 schematically illustrates another example circuit for computing a universal polynomial hash function, such as GHASH function, in a manner resistant to external monitoring attacks, by first masking the hash key and then iteratively processing the operand bits starting from the first block of the input data, performing a field multiplication operation on a given input data block and the masked hash key, computing the mask correction value for the given iteration and performing the mask correction at the end of the operation before processing the next input block of data in accordance with one or more aspects of the present disclosure;

FIG. 4 schematically illustrates an example method of performing a field multiplication operation by iteratively processing the operand starting from the LSB, in accordance with one or more aspects of the present disclosure;

FIG. 5 schematically illustrates an example method of performing a field multiplication operation by iteratively processing the operand bits starting from the MSB, in accordance with one or more aspects of the present disclosure;

FIG. 6 depicts a flow diagram of an example method for computing the example polynomial hash function in a manner resistant to external monitoring attacks, by masking the first input data block, and re-using the corresponding mask correction value as the mask in the subsequent iterations, in accordance with one or more aspects of the present disclosure;

FIG. 7 depicts a flow diagram of an example method for computing the example polynomial hash function in a manner resistant to external monitoring attacks, by masking the hash key, in accordance with one or more aspects of the present disclosure; and

FIG. 8 depicts a flow diagram of a generalized example method for computing the example polynomial hash function in a manner resistant to external monitoring attacks, in accordance with one or more aspects of the present disclosure;

FIG. 9 illustrates a diagrammatic representation of an example computing system within which a set of instructions, for causing the computing device to perform the methods described herein, may be executed.

DETAILED DESCRIPTION

Described herein are systems and methods for protecting from external monitoring attacks cryptographic data processing operations involving universal polynomial hash function computation.

“Cryptographic data processing operation” herein shall refer to a data processing operation involving secret parameters (e.g., encryption/decryption operations using secret keys). “Cryptographic data processing device” herein shall refer to a data processing device (e.g., a general purpose or specialized processor, a system-on-chip, a cryptographic hardware accelerator, or the like) configured or employed for performing cryptographic data processing operations.

“External monitoring attack” herein refers to a method of gaining unauthorized access to protected information by deriving one or more protected information items from certain aspects of the physical implementation and/or operation of the target cryptographic data processing device. Side channel attacks are external monitoring attacks that are based on measuring values of one or more physical parameters associated with operations of the target cryptographic data processing device, such as the elapsed time of certain data processing operations, the power consumption by certain circuits, the current flowing through certain circuits, heat or electromagnetic radiation emitted by certain circuits of the target cryptographic data processing device, etc.

Various side channel attacks may be designed to obtain unauthorized access to certain protected information (e.g., encryption keys that are utilized to transform the input plain text into a cipher text) being stored within and/or processed by a target cryptographic system. In an illustrative example, an attacker may exploit interactions of sequential data manipulation operations which are based on certain internal states of the target data processing device. The attacker may apply differential power analysis (DPA) methods to measure the power consumption by certain circuits of a target cryptographic data processing device responsive to varying one or more data inputs of sequential data manipulation operations, and thus determine one or more protected data items (e.g., encryption keys) which act as operands of the data manipulation operations.

Systems and methods of the present disclosure employ various masking schemes for performing certain cryptographic operations in a manner resistant to external monitoring attacks. In an illustrative example, a masking scheme may involve applying a randomly generated integer mask to a secret value by performing the bitwise exclusive disjunction operation. The result of the single-bit exclusive disjunction is true (binary 1), if and only if one of the two operands is true; otherwise, the result is false (binary 0). Therefore, the result of applying the exclusive disjunction operation to two equal operands is always false. In order to mask a secret value S, a mask M is applied to it by the exclusive disjunction operation: S*=S⊕M; to remove the mask, the exclusive disjunction is performed on the masked secret value and the mask:

S=S*⊕M=(S⊕M)⊕M=S⊕(M⊕M)=S⊕0=S.

However, in more complex scenarios, e.g., in which a masked value is processed by a non-linear operation, the mask correction value (i.e., the value that is employed to remove a previously applied mask) would differ from the mask, as described in more detail herein below.

The present disclosure describes systems and methods for computing, in a manner protected from various side channel attacks, values of so-called universal polynomial hash functions that are based on certain polynomial evaluation functions in finite fields. In an illustrative example, a polynomial function may be represented by the following function:

g _(k)(x)=Σ_(i=0) ^(t) x _(i) ·k ^(i) , x _(i) , k ∈ GF(2^(n)),

where GF(2^(n)) refers to a Galois field which may be viewed as a finite set of n-bit integers with addition and multiplication operations defined on the field elements. Each of the operations maps a pair of field elements onto another field element. Multiplication of two elements in GF(2^(n)) involves multiplying the polynomials representing the elements and dividing the resulting 2n-bit polynomial by the chosen irreducible field polynomial, thus producing an n-bit result. Addition of two elements involves adding the polynomials, which in GF(2^(n)) is equivalent to performing the bitwise exclusive disjunction of the two elements.

The systems and methods of the present disclosure may be employed for protecting, from side-channel attacks, implementations of a wide spectrum polynomial hash functions, such as Poly1305 cryptographic message authentication code (MAC) that can be used for verifying the data integrity and authenticity of a message. In particular, the systems and methods of the present disclosure may be employed for protecting implementations of the keyed GHASH function utilized in the Galois Counter Mode of Operation (GCM) method.

Mode of operation herein refers to an algorithm that defines how to repeatedly apply a block cipher single-block operation to transform amounts of data that exceeds the size of a single block. GCM is a block cipher mode of operation that uses universal hashing over a binary Galois field to provide authenticated encryption. GCM has two operations, authenticated encryption and authenticated decryption. The authenticated encryption operation inputs a secret key, an initialization vector, a plaintext, and additional authentication data (AAD) and produces a ciphertext and an authentication tag associated with the ciphertext. The authenticated decryption operation inputs the secret key, the initialization vector, the ciphertext, the AAD, and the authentication tag, and produces either the plaintext or a special symbol FAIL that indicates that the inputs are not authentic.

GCM encryption and decryption operations utilize the GHASH function which is a type of a universal hash function. An example method of computation GHASH values is described herein below with reference to FIG. 1. In particular, computing GHASH involves several multiplication and addition operations in the Galois field GF(2¹²⁸).

In certain implementations, multiplication operations may be protected from external monitoring attacks by masking both the multiplier and multiplicand. Such a scheme would involve performing four multiplications in the Galois field and would further require a new mask for every masking operation, or in other words, for every block of the input data (ciphertext and AAD).

The present disclosure improves the efficiency of universal polynomial hash functions (e.g., GHASH) computation by providing masking schemes that fit the iterative structure of the universal polynomial hash functions. Example methods of the present disclosure involve performing parallel multiplication operations to iteratively calculate the masked iteration result and the mask correction value by masking only one multiplication operand (e.g., masked data or masked hash key) and re-using mask correction value as a corresponding mask for the next iteration. Each field multiplication operation may involve iteratively processing the operand bits. The side channel attack resistance of the example methods may be further improved by preventing synchronous appearance in a register bank, in a memory, or on a communication bus of partial masked iteration results and masked correction values.

Thus, in an illustrative example, the parallel multiplication operations may be deliberately de-synchronized, by introducing a delay of one or more clock cycles between the start of the first multiplication operation and the start of the second multiplication operation. In another illustrative example, the parallel multiplication operations may be performed in the opposite bitwise order, by iteratively processing the operand bits starting from the least significant bit (LSB) in one of the multiplication operations and iteratively processing the operand bits starting from the MSB in the other multiplication operation, as described in more detail herein below. The LSB herein shall refer to the leftmost bit (e.g., x₀ for 128-bit integers represented as x₀ . . . x₁₂₇), and the MSB herein shall refer to the rightmost bit (e.g., x₁₂₇ for 128-bit integers represented as x₀ . . . x₁₂₇).

Thus, the systems and methods described herein represent improvements to the functionality of general purpose or specialized computing devices, by enabling performance of cryptographic data processing operations in a manner resistant to external monitoring attacks.

The systems and methods described herein may be implemented by hardware (e.g., general purpose and/or specialized processing devices, and/or other devices and associated circuitry), software (e.g., instructions executable by a processing device), or a combination thereof. Various aspects of the methods and systems are described herein by way of examples, rather than by way of limitation.

In various illustrative examples described herein below, cryptographic data processing devices may be configured or employed for implementing cryptographic operations utilizing GHASH function employed by the GCM method. However, the systems and methods described herein for performing cryptographic data processing operations in a manner resistant to external monitoring attacks may be applicable to various other cryptographic data processing devices and methods.

FIG. 1 schematically illustrates an example circuit for computing an unmasked universal polynomial hash function, such as GHASH function, in accordance with one or more aspects of the present disclosure. In the example implementation illustrated by FIG. 1, values of the GHASH function are produced by iteratively multiplying, in the GF(2¹²⁸) field, a hash key by data blocks comprising the input data, e.g. ciphertext and/or AAD:

X _(i)=(X _(i−1) ⊕C _(i))*H=(X _(i−1) *H)⊕(C _(i) *H),

where C_(i) denotes the i-th input data block,

X_(i) denotes the result of the i-th iteration,

H denotes the hash key,

symbol * denotes multiplication operation in the associated Galois field, and

symbol ⊕ denotes the addition operation in the associated Galois field; this operation is also known as an exclusive disjunction operation (also referred to as exclusive or, XOR).

As schematically illustrated by FIG. 1, the circuit 100 may include a Galois field multiplier 110 that may be employed to multiply, in the GF(2¹²⁸) field, the contents of the hash key register 120 and accumulator 130. The hash key register 120 may be employed to store the hash key value. The accumulator 130 may be employed to store the result of performing, by the adder 140, the exclusive disjunction operation on the result of the previous iteration X′_(i−1) and the input data block C_(i) comprising the ciphertext and/or additional authentication data (AAD). The register 150 may be employed to store the result produced by the multiplier 110.

In order to compute a universal polynomial hash function (e.g., an example GHASH function described herein above with reference to FIG. 1) in a manner resistant to external monitoring attacks, methods and systems of the present disclosure utilize various masking schemes. In an illustrative example, a masking scheme employed to protect the example polynomial hash function implementation may involve masking the first input data block, and re-using the corresponding mask correction value as the mask in the subsequent iterations. Therefore, the first masked multiplication may be defined as follows:

X′₁=(X₀⊕M⊕C₁)*H, where X₀ denotes the initialization value for computing a polynomial hash function, which, for GHASH function is defined to be 0¹²⁸, M denotes a random integer value utilized as the mask, and X′₁ denotes the masked result of the first iteration.

Due to the distributive property of multiplication over addition, which, in the case of GHASH corresponds to exclusive disjunction,

X′ ₁=(X ₀ ⊕M⊕C ₁)*H=((X ₀ *H)⊕(C ₁ *H))⊕(M*H).

By definition of the example GHASH function presented herein above,

X ₁=((X ₀ *H)⊕(C ₁ *H)).

Therefore, X′ ₁=((X ₀ *H)⊕(C ₁ *H))⊕(M*H)=X ₁⊕(M*H).

The masked result of the first iteration is used as the thus masked input for the next iteration: X′₂=(X′₁⊕C₂)*H, where X′₂ denotes the masked result of the second iteration.

By performing the transformations that are similar to those that have been performed in the first iteration, the masked result of the second iteration X′₂ may be determined as follows:

     X₂^(′) = (X₁^(′) ⊕ C₂)^(*)H = ((X₁ ⊕ (M^(*)H)^(*)H) ⊕ (C₂^(*)H) =  = (X₁^(*)H) ⊕ (M^(*)H²) ⊕ (C₂^(*)H) = ((X₁^(*)H) ⊕ (C₂^(*)H)) ⊕ (M^(*)H²)=      = X₂ ⊕ (M^(*)H²).

The above definition of the second iteration may be generalized to define the i-th iteration as follows:

X_(i)^(′) = (X_(i − 1)^( ^(′)) ⊕ C_(i))^(*)H = ((X_(i − 1) ⊕ (M^(*)H^(i − 1))^(*)H) ⊕ (C_(i)^(*)H) =  = ((X_(i − 1)^(*)H) ⊕ (C_(i)^(*)H)) ⊕ (M^(*)H^(i)) =  = X_(i) ⊕ (M^(*)H^(i)),

where X′_(i) denotes the masked result of the i-th iteration.

The result of the last iteration may be unmasked by performing the exclusive disjunction operation with the mask correction value MC_(k)=M*H^(k):

X_(k)=X′_(k)⊕(M*H^(k)), where k denotes the number of iterations. In an illustrative example, k=m+n+1, where m is the number of input blocks in the AAD and n is the number of ciphertext blocks.

Since the mask correction value MC_(k)=M*H^(k) is independent from the input and feedback (i.e. previous iteration result) values, the mask correction value may be computed in parallel with the masked hash function computation if two hardware multipliers are available. Alternatively, the masked hash function and the mask correction value may be computed using a single multiplier, either in an interleaved fashion or sequentially.

In certain implementations, the two parallel multiplication operations may be deliberately de-synchronized, by introducing a delay of one or more clock cycles between the start of the multiplication operation that produces the masked data and the start of the multiplication operation that produces the mask correction value. Furthermore, the two parallel multiplication operations may be performed in the opposite bitwise order, by iteratively processing the operand bits starting from the LSB in one of the multiplication operations and iteratively processing the operand bits starting from the MSB in the other multiplication operation. In an illustrative example, the multiplication operation that produces the masked data may be performed by iteratively processing the operand bits starting from the LSB, while the multiplication operation that produces the mask correction value by iteratively processing the operand bits starting from the MSB. Alternatively, the multiplication operation that produces the masked data may be performed by iteratively processing the operand bits starting from the MSB, while the multiplication operation that produces the mask correction value by iteratively processing the operand bits starting from the LSB, as described in more detail herein below.

FIG. 2 schematically illustrates an example circuit for computing a universal polynomial hash function, such as GHASH function, in a manner resistant to external monitoring attacks, in accordance with one or more aspects of the present disclosure. The example implementation of FIG. 2 may involve masking the first input data block, and re-using the corresponding mask correction value as the mask in the subsequent iterations, as described in more detail herein above.

As schematically illustrated by FIG. 2, the circuit 200 may include two finite field multipliers 210 and 215, such that the first multiplier 210 may be employed to multiply, in the finite field, for example, in the GF(2¹²⁸) field, the contents of the hash key register 220 and accumulator 225. The hash key register 220 may be employed to store the hash key value. The accumulator 225 may be employed to store the result of performing, by the adder 230, the exclusive disjunction operation on the masked result of the previous iteration X′_(i−1) and the output of the selector 235. The selector 235 produces the value of C₁⊕M that is outputted by the adder 238 for the first iteration; the selector 235 bypasses the adder 238 to produce the value of C_(i) for the subsequent iterations. Thus, the first multiplier 210 produces the masked value of X′₁=X₁⊕(M*H) in the first iteration, and the masked value of X′_(i)=(X′_(i−1)⊕C_(i))*H in each subsequent iteration. The value produced by the first multiplier 210 may be stored in the register 240, which feeds the selector 245.

The second multiplier 215 may be employed to multiply, in the finite field, for example in the GF(2¹²⁸) field, the contents of the hash key register 220 and the mask register 250. The mask register 250 stores the value produced by the selector 255, which is the mask value M in the first iteration and the mask correction value of MC_(i)=H*MC_(i−1) in each subsequent iteration. Thus, the second multiplier 215 produces the value of H*M in the first iteration, and the mask correction value of MC_(i)=H*MC_(i−1) in each subsequent iteration, where MC_(i)=M*H^(i). The value produced by the second multiplier 215 may be stored in the register 260, which feeds the selector 265.

The first multiplier 210 and the second multiplier 215 may be configured to perform the field multiplication operations in the opposite bitwise order, by iteratively processing the operand bits starting from the LSB in one of the multiplication operations and iteratively processing the operand bits starting from the MSB in the other multiplication operation, as described in more detail herein below.

In all iterations except for the last one, the output of the first multiplier 210 is supplied, by the selector 245, as the input to the adder 230. In the last iteration, the selector 245 supplies the output of the first multiplier 210 to the adder 270. In all iterations except for the last one, the output of the second multiplier 215 is supplied, by the selector 265, as the input to the selector 255. In the last iteration, the selector 265 supplies the output of the second multiplier 215 to the adder 270. The adder 270 performs the unmasking operation after the last iteration, by producing the exclusive disjunction of the outputs of selectors 245 and 265: X_(k)=X′_(k) ⊕(M*H^(k)), where k denotes the number of iterations.

Thus, the example circuit 200 computes a universal polynomial hash function, such as the GHASH function, in a manner resistant to external monitoring attacks, by masking the first input data block, and re-using the corresponding mask correction value as the mask in the subsequent iterations.

In another illustrative example, a masking scheme employed to protect the example polynomial hash function implementation may involve masking the hash key. Therefore, the masked value produced by the i-th iteration may be defined as follows:

X′ _(i)=(X _(i−1) ⊕C _(i))*H′,

where H′=H⊕M is the masked hash key value.

After each iteration, the mask may be removed by applying the mask correction value MC_(i)=(X_(i−1)⊕C_(i))*M to the masked iteration result:

X _(i)=((X _(i−1) ⊕C _(i))*(H⊕M))⊕((X _(i−1) ⊕C _(i))*M)

Due to the distributive property of multiplication over addition, which corresponds to exclusive disjunction in the case of GHASH,

((X _(i−1) ⊕C _(i))*(H⊕M))⊕((X _(i−1) ⊕C _(i))*M)=(X _(i−1) ⊕C _(i))*(H⊕M⊕M)

Finally, since M⊕M=0,

(X_(i−1)⊕C_(i))*(H⊕M⊕M)=(X_(i−1)⊕C_(i))*H, thus producing the unmasked result of the i-th iteration.

Therefore, at each iteration two finite field multiplication operations are performed. For example, for GHASH function, two operations in GF(2¹²⁸) are performed. Therefore, the mask correction value may be computed in parallel with the masked iteration result computation if two hardware multipliers are available. Alternatively, the masked iteration result and the mask correction value may be computed using a single multiplier, either in an interleaved fashion or sequentially.

In certain implementations, the two parallel multiplication operations may be deliberately de-synchronized, by introducing a delay of one or more clock cycles between the start of the multiplication operation that produces the masked data and the start of the multiplication operation that produces the mask correction value. Furthermore, the two parallel multiplication operations may be performed in the opposite bitwise order, by iteratively processing the operand bits starting from the LSB in one of the multiplication operations and iteratively processing the operand bits starting from the MSB in the other multiplication operation. In an illustrative example, the multiplication operation that produces the masked data may be performed by iteratively processing the operand bits starting from the LSB, while the multiplication operation that produces the mask correction value by iteratively processing the operand bits starting from the MSB. Alternatively, the multiplication operation that produces the masked data may be performed by iteratively processing the operand bits starting from the MSB, while the multiplication operation that produces the mask correction value by iteratively processing the operand bits starting from the LSB, as described in more detail herein below.

FIG. 3 schematically illustrates an example circuit for computing a universal polynomial hash function, such as a GHASH function, in a manner resistant to external monitoring attacks, in accordance with one or more aspects of the present disclosure. The example implementation of FIG. 3 may involve masking the hash key, as described in more detail herein above.

As schematically illustrated by FIG. 3, the circuit 300 may include two finite field multipliers 310 and 315, such that the first multiplier 310 may be employed to multiply, in the finite field, the contents of the masked hash key register 320 and accumulator 325. In the case of GHASH function, the multipliers 310 and 315 are multipliers in the GF(2¹²⁸). The masked hash key register 320 may be employed to store the masked hash key value H⊕M. The accumulator 325 may be employed to store the result of performing, by the adder 330, the addition operation (which is represented by the exclusive disjunction operation in the case of GHASH function) on the result of the previous iteration X_(i−1) and the input block C_(i) comprising the ciphertext and/or additional authentication data (AAD):

X _(i)=(X _(i−1) ⊕C _(i)).

The value produced by the first multiplier 310 may be fed to the adder 335.

The second multiplier 315 may be employed to multiply, in the finite field, for example, in the case of the GHASH function, in GF(2¹²⁸) field, the contents of the accumulator 325 and the mask register 340. Thus, the second multiplier 315 produces the mask correction value of MC_(i)=(X_(i−1)⊕C_(i))*M. The mask correction value produced by the second multiplier 315 may be fed to the adder 335.

The first multiplier 310 and the second multiplier 315 may be configured to perform the field multiplication operations in the opposite bitwise order, by iteratively processing the operand bits starting from the LSB in one of the multiplication operations and iteratively processing the operand bits starting from the MSB in the other multiplication operation, as described in more detail herein below.

The adder 335 performs the unmasking operation after each iteration, by producing the sum (which is represented by the exclusive disjunction in the case of GHASH function) of the outputs of the multipliers 310 and 315:

X_(i)=((X_(i−1)⊕C_(i))*(H⊕M))⊕((X_(i−1)⊕C_(i))*M)=(X_(i−1)⊕C_(i))*H, thus producing the unmasked result of the i-th iteration, which may be stored in the register 345. In all iterations except for the last one, the value stored by the register 345 may be supplied as the input to the adder 330. Upon completion of the last iteration, the register 345 stores the result value of a universal polynomial hash function, for example, GHASH function value.

Thus, the example circuit 300 computes a universal polynomial hash function, such as the GHASH function in a manner resistant to external monitoring attacks, by masking the hash key and removing the mask by applying the mask correction value to the masked iteration result.

As noted herein above, the parallel multiplication operations (e.g., the first multiplication operation that produces the masked intermediate result of the polynomial hash function and the second multiplication operation that produces the mask correction value) may be performed in the opposite bitwise order, by iteratively processing the operand bits starting from the LSB in one of the multiplication operations and iteratively processing the operand bits starting from the MSB in the other multiplication operation, as described in more detail herein below with references to FIGS. 4-5.

FIG. 4 schematically illustrates an example method of performing a field multiplication operation by iteratively processing the operand bits starting from the LSB, in accordance with one or more aspects of the present disclosure. As schematically illustrated by FIG. 4, the first bit sequence, denoted X, is multiplied by the second bit sequence, denoted Y. Iterations 400A-400N are performed to modify the auxiliary interim value V and the interim result value Z, as described herein below. For each iteration 400A-400N, FIG. 4 illustrates the auxiliary interim value V_(i) (column 410), the exclusive disjunction operation that is performed at some of the iterations on the auxiliary interim value Vi and the field reduction modulus R (column 420), and the interim result value Z_(i) (column 430). The method starts by initializing the auxiliary interim value V with the value of the second bit sequence: V₀=Y and initializing the interim result value Z₀ with 0. The method iterates through the bits of the first bit sequence X, starting from the leftmost bit, denoted x₀. At each iteration 400A-400N, the auxiliary interim value V_(i) and the interim result value Z_(i) are updated as follows.

At the i-th iteration, the interim result value Z_(i) remains unchanged if the i-th bit of the first bit sequence is zero; otherwise, the exclusive disjunction of the current interim result value Z_(i) and the auxiliary interim value V_(i) forms the new interim result value Z_(i+1):

Z _(i+1) =Z _(i) if x _(i)=0, otherwise Z _(i+1) =Z _(i) ⊕V _(i).

The first situation (i.e., x_(i)=0) is schematically illustrated in FIG. 4 by the lines that show computation of the values Z₃-Z₇; the second situation (i.e., x_(i)=1) is schematically illustrated by the lines that show computation of the values Z₁, Z₂, and Z₈.

Also at the i-th iteration, the interim auxiliary value V_(i) is shifted by one bit to the right (which is equivalent to multiplying the value by 2). If the MSB of the interim auxiliary value V_(i) is zero, the shifted interim auxiliary value V_(i) is saved as the new interim auxiliary value V_(i+1); otherwise, the shifted interim auxiliary value V_(i) is further combined, by the exclusive disjunction operation, with the field reduction modulus R, and the result is saved as the new interim auxiliary value V_(i+1): V_(i+1)=V_(i)>>1 if MSB₁(V_(i))=0, otherwise V_(i+1)=(V_(i)>>1)⊕R.

The first situation (i.e., MSB₁(V_(i))=0) is schematically illustrated by the lines that show computation of the values V₃ and V₄; the second situation (i.e., MSB₁(V_(i))=1) is schematically illustrated by the lines that show computation of the values V₁, V₂, and V₅-V₇.

After the final iteration, the value of Z_(n) represents the multiplication result.

While the elements of the GF(2¹²⁸) field are represented by 128-bit sequences, the illustrative example of FIG. 4 operates by 8-bit sequences. However, the method described with reference to FIG. 4 may, without limitations, be applied to bit sequences of arbitrary selected size. Thus, the method of multiplying 128-bit sequences by iteratively processing the operand bits starting from the LSB may be formally described as follows.

The auxiliary interim value V is initialized with the value of the second bit sequence: V₀=Y and the interim result value Z₀ is initialized with 0¹²⁸. At each iteration 0-127, the auxiliary interim value V_(i) and the interim result value Z_(i) are updated as follows:

Z _(i+1) =Z _(i) if x _(i)=0, otherwise Z _(i+1) =Z _(i) ⊕V _(i)

V _(i+1) =V _(i)>>1 if MSB₁(V _(i))=0, otherwise V _(i+1)=(V _(i)>>1)⊕R

After the final iteration, the value of Z₁₂₈ represents the multiplication result.

FIG. 5 schematically illustrates an example method of performing a field multiplication operation by iteratively processing the operand bits starting from the MSB, in accordance with one or more aspects of the present disclosure. As schematically illustrated by FIG. 5, the first bit sequence, denoted X, is multiplied by the second bit sequence, denoted Y. Iterations 500A-500N are performed to modify the interim result value Z, as described herein below. For each iteration 500A-500N, FIG. 5 illustrates the i-th bit of the first bit sequence, denoted x_(i) (column 510), the interim result value Z_(i) (column 520), and the exclusive disjunction operation that is performed at some of the iterations on the interim result value Z_(i) and the field reduction modulus R (column 530). The method starts by initializing the interim result value Z with zero: Z₀=0¹²⁸. The method iterates through the bits of the first bit sequence X, starting from the rightmost bit, denoted x₁₂₇. At each iteration 500A-500N, the interim result value Z_(i) is updated as follows.

At the i-th iteration, the interim result value Z_(i) is shifted by one bit to the right (which is equivalent to multiplying the value by 2). If both the MSB of the interim auxiliary value Z_(i) and the (127−i)-th bit of the first multiplication operand X are zeros, the shifted interim result value Z_(i) is saved as the new interim auxiliary value Z_(i+1): Z_(i+1)=Z_(i)>>1 if x_(127−i)=0 and MSB₁(Z_(i))=0, as schematically illustrated in FIG. 5 by the lines that show computation of the value Z₄ and Z₅.

Otherwise, if the MSB of the interim auxiliary value Z_(i) is zero and the (127−i)-th bit of the first multiplication operand X is one, the shifted interim result value Z_(i) is further combined, by the exclusive disjunction operation, with the second multiplication operand Y, and the result is saved as the new interim result value Z_(i+1): Z_(i+1)=(Z_(i)>>1)⊕Y if x_(127−i)=1 and MSB₁(Z_(i))=0, as schematically illustrated in FIG. 5 by the lines that show computation of the value Z₁ and Z₈.

Otherwise, if the MSB of the interim auxiliary value Z_(i) is one and the (127−i)-th bit of the first multiplication operand X is zero, the shifted interim result value Z_(i) is further combined, by the exclusive disjunction operation, with the field reduction modulus R, and the result is saved as the new interim result value Z_(i+1): Z_(i+1)=(Z_(i)>>1)⊕R if x_(127−i)=0 and MSB₁(Z_(i))=1, as schematically illustrated in FIG. 5 by the lines that show computation of the value Z₂, Z₃ and Z₆.

Otherwise, if both the MSB of the interim auxiliary value Z_(i) and the (127−i)-th bit of the first multiplication operand X are equal to one, the shifted interim result value Z_(i) is further combined, by consecutive exclusive disjunction operations, with the second multiplication operand Y and the field reduction modulus R, and the result is saved as the new interim result value Z_(i+1): Z_(i+1)=(Z_(i)>>1)⊕Y⊕R if x_(127−i)=1 and MSB₁(Z_(i))=1, as schematically illustrated in FIG. 5 by the lines that show computation of the value Z₇. After the final iteration, the value of Z_(n) represents the multiplication result.

While the elements of the GF(2¹²⁸) field are represented by 128-bit sequences, the illustrative example of FIG. 5 operates by 8-bit sequences. However, the method described with reference to FIG. 5 may, without limitations, be applied to bit sequences of arbitrary selected size. Thus, the method of multiplying 128-bit sequences by iteratively processing the operand bits starting from the LSB may be formally described as follows.

The interim result value Z₀ is initialized with 0¹²⁸. At each iteration 0-127, the interim result value Z_(i) is updated as follows:

Z _(i+1) =Z _(i)>>1 if x _(127−i)=0 and MSB₁(Z _(i))=0

Z _(i+1)=(Z _(i)>>1)⊕Y if x _(127−i)=1 and MSB₁(Z _(i))=0

Z _(i+1)=(Z _(i)>>1)⊕R if x _(127−i)=0 and MSB₁(Z _(i))=1

Z _(i+1)=(Z _(i)>>1)⊕Y⊕R if x _(127−i)=1 and MSB₁(Z _(i))=1

Where x_(127−i) references (127−i)-th bit of the first multiplication operand X, Y references the second multiplication operand, and R references the field reduction modulus. After the final iteration, the value of Z₁₂₈ represents the multiplication result.

FIG. 6 depicts a flow diagram of an example method 600 for computing the example universal polynomial hash function in a manner resistant to external monitoring attacks, by masking the first input data block, and re-using the corresponding mask correction value as the mask in the subsequent iterations, in accordance with one or more aspects of the present disclosure. Method 600 and/or each of its individual functions, routines, subroutines, or operations may be performed by one or more general purpose and/or specialized processing devices. Two or more functions, routines, subroutines, or operations of method 600 may be performed in parallel or in an order that may differ from the order described above. In certain implementations, method 600 may be performed by a single processing thread. Alternatively, method 600 may be performed by two or more processing threads, each thread executing one or more individual functions, routines, subroutines, or operations of the method. In an illustrative example, the processing threads implementing method 600 may be synchronized (e.g., using semaphores, critical sections, and/or other thread synchronization mechanisms). Alternatively, the processing threads implementing method 600 may be executed asynchronously with respect to each other. In an illustrative example, method 600 may be performed by the circuit 200 described herein above with references to FIG. 2. In another illustrative example, method 600 may be performed by the computing system 1000 described herein below with references to FIG. 9. In yet another illustrative example, method 600 may be performed by the computing system 1000 of FIG. 9 that is equipped with a cryptographic hardware accelerator implementing the structure and functions of the circuit 200 of FIG. 2.

Referring to FIG. 6, at block 610, a processing device implementing the method may apply a mask value to the first input data block to initialize the masked iteration result value:

X′ ₁=((X ₀ ⊕M)⊕C ₁)*H).

The first input data block may include a block of the ciphertext or a block of AAD.

At block 620, the processing device may multiply the mask value to the hash key value to initialize the mask correction value: MC₁=M*H, as described in more detail herein above. The multiplication operation is performed in the finite field, for example GF(2¹²⁸) field.

Blocks 630-660 describe the operations that are iteratively performed on each incoming data block, starting from the second one. Each input data block may include a block of the ciphertext or a block of AAD.

At block 630, the processing device may receive the i-th input data block C_(i).

At block 640, the processing device may multiply a hash key by a combination of the input data block and the masked result value of the previous iteration to produce the new masked result value, which is then be fed back to the input of the next iteration: X′_(i)=(X′_(i−1)⊕C_(i))*H, as described in more detail herein above. The multiplication operation is performed in the finite field, for example, in GF(2¹²⁸) field for the GHASH function. The combination of the input data block and the masked result value herein refers to the exclusive disjunction of the input data block and the masked result value.

At block 650, the processing device may multiply the hash key by the mask correction value of the previous iteration to produce the new mask correction value, which is then be fed back to the input of the next iteration: MC_(i)=H*MC_(i−1), as described in more detail herein above.

In certain implementations, the multiplication operations referenced by blocks 640 and 650 may be performed in parallel and may be deliberately de-synchronized, by introducing a delay of one or more clock cycles between the start of the multiplication operation that produces the masked data and the start of the multiplication operation that produces the mask correction value. Furthermore, the two parallel multiplication operations may be performed in the opposite bitwise order, by iteratively processing the operand bits starting from the LSB in one of the multiplication operations and iteratively processing the operand bits starting from the MSB in the other multiplication operation, as described in more detail herein above.

As noted herein above, depending upon the number of available hardware multiplier circuits, operations of blocks 640 and 650 may be performed simultaneously or sequentially with respect to each other.

Responsive to determining, at block 660, that the current input data block is the last one, the operations may continue at block 670; otherwise, the method may loop back to block 630.

At block 670, the processing device may produce the unmasked result value by applying the mask correction value to the masked result value: X_(k)=X′_(k)⊕(M*H^(k)), where k denotes the number of iterations, as described in more detail herein above. The unmasked result value represents the value of computed universal polynomial hash function, for example, the GHASH function. Responsive to completing operations of block 470, the method may terminate.

FIG. 7 depicts a flow diagram of an example method 700 for computing the example hash function in a manner resistant to external monitoring attacks, by masking the hash key, in accordance with one or more aspects of the present disclosure. Method 700 and/or each of its individual functions, routines, subroutines, or operations may be performed by one or more general purpose and/or specialized processing devices. Two or more functions, routines, subroutines, or operations of method 700 may be performed in parallel or in an order that may differ from the order described above. In certain implementations, method 700 may be performed by a single processing thread. Alternatively, method 700 may be performed by two or more processing threads, each thread executing one or more individual functions, routines, subroutines, or operations of the method. In an illustrative example, the processing threads implementing method 700 may be synchronized (e.g., using semaphores, critical sections, and/or other thread synchronization mechanisms). Alternatively, the processing threads implementing method 700 may be executed asynchronously with respect to each other. In an illustrative example, method 700 may be performed by the circuit 300 described herein above with references to FIG. 3. In another illustrative example, method 700 may be performed by the computing system 1000 described herein below with references to FIG. 9. In yet another illustrative example, method 700 may be performed by the computing system 1000 of FIG. 9 that is equipped with a cryptographic hardware accelerator implementing the structure and functions of the circuit 300 of FIG. 3.

Referring to FIG. 7, at block 710, a processing device implementing the method may apply the masked hash key value to the first input data block to initialize the masked iteration result value: X′₁=(M⊕H)*(C₁⊕X₀), where X₀ is the initialization for computing a universal polynomial hash function; for example, X₀=0¹²⁸. The masked hash key may be provided by the exclusive disjunction of the mask value and the hash key value, as described in more detail herein above. The method may apply the mask value to the first input data block to initialize the mask correction value: MC₁=(C₁⊕X₀)*M.

The first input data block may include a block of the ciphertext or a block of AAD.

Blocks 720-760 describe the operations that are iteratively performed on each incoming data block, starting from the second one. Each input data block may include a block of the ciphertext or a block of AAD.

At block 720, the processing device may receive the i-th input data block C_(i).

At block 730, the processing device may multiply the masked hash key by a combination of the received input data block and the unmasked iteration result value to produce a masked iteration result value: X′_(i)=(X_(i−1)⊕C_(i))*(H⊕M), as described in more detail herein above. The multiplication operation is performed in the finite field, for example, in the GF(2¹²⁸) field in case of the GHASH function. The combination of the input data block and the unmasked iteration result value herein refers to the exclusive disjunction of the received input data block and the unmasked iteration result value.

At block 740, the processing device may multiply the mask value by a combination of the input data block and the unmasked previous iteration result value to produce a mask correction value: MC_(i)=(X_(i−1)⊕C_(i))*M, as described in more detail herein above.

In certain implementations, the multiplication operations referenced by blocks 730 and 740 may be performed in parallel and may be deliberately de-synchronized, by introducing a delay of one or more clock cycles between the start of the multiplication operation that produces the masked data and the start of the multiplication operation that produces the mask correction value. Furthermore, the two parallel multiplication operations may be performed in the opposite bitwise order, by iteratively processing the operand bits starting from the LSB in one of the multiplication operations and iteratively processing the operand bits starting from the MSB in the other multiplication operation, as described in more detail herein above.

At block 750, the processing device may produce the new unmasked iteration result value by applying the mask correction value MC_(i) to the masked current iteration result value: X_(i)=((X_(i−1)⊕C_(i))*(H⊕M))⊕((X_(i−1)⊕C_(i))*M), as described in more detail herein above.

Responsive to determining, at block 760, that the current input data block is the last one, the method may terminate; otherwise, the method may loop back to block 720. The unmasked result value represents the value of a universal polynomial hash function, such as GHASH function.

FIG. 8 depicts a flow diagram of a generalized example method 800 for computing the example hash function in a manner resistant to external monitoring attacks, in accordance with one or more aspects of the present disclosure. Method 800 describe example implementations of example methods 600 and 700, in which the multiplication operations referenced by blocks 640-650 and 730-740 are performed in parallel and in the opposite bitwise order, by iteratively processing the operand bits starting from the LSB in one of the multiplication operations and iteratively processing the operand bits starting from the MSB in the other multiplication operation. Method 800 and/or each of its individual functions, routines, subroutines, or operations may be performed by one or more general purpose and/or specialized processing devices. Two or more functions, routines, subroutines, or operations of method 800 may be performed in parallel or in an order that may differ from the order described above. In certain implementations, method 800 may be performed by a single processing thread. Alternatively, method 800 may be performed by two or more processing threads, each thread executing one or more individual functions, routines, subroutines, or operations of the method. In an illustrative example, the processing threads implementing method 800 may be synchronized (e.g., using semaphores, critical sections, and/or other thread synchronization mechanisms). Besides, the processing threads implementing method 800 may be executed asynchronously with respect to each other. In an illustrative example, method 800 may be performed by the circuit 300 described herein above with references to FIG. 3. In another illustrative example, method 800 may be performed by the computing system 1000 described herein below with references to FIG. 9. In yet another illustrative example, method 800 may be performed by the computing system 1000 of FIG. 9 that is equipped with a cryptographic hardware accelerator implementing the structure and functions of the circuit 300 of FIG. 3.

Referring to FIG. 8, blocks 810-840 describe the operations that are iteratively performed on each incoming data block, which may include a block of the ciphertext or a block of AAD.

At block 810, a processing device implementing the i-th iteration of the method may receive the i-th input data block and the current iteration result value.

At block 820, the processing device may perform the first field multiplication operation to produce a new iteration result value. The processing device may iteratively process, starting from a chosen first bit position, the bits of a combination of the input data block and the iteration result value. The first bit position may be represented by one of the LSB or the MSB. In an illustrative example, the first multiplication operation may multiply the hash key by the combination of the input data block and the masked iteration result value. In another illustrative example, the first multiplication operation may multiply the masked hash key by the combination of the input data block and the iteration result value, as described in more details herein above.

At block 830, the processing device may perform the second field multiplication operation to produce a new mask correction value. The processing device may iteratively process the operand bits starting from a chosen second bit position. The second bit position may be different from the first bit position and may be represented by one of the LSB or the MSB, so that the two multiplication operations are performed in different bitwise orders. In an illustrative example, the second multiplication operation may multiply the masked hash key by the mask correction value. In another illustrative example, the second multiplication operation may multiply the mask value by the combination of the input data block and the iteration result value, as described in more details herein above.

At block 840, the processing device may apply the new mask correction value to the new iteration result value. Responsive to determining, at block 850, that the current input data block is the last one, the method may terminate; otherwise, the method may loop back to block 810. The unmasked result value represents the value of GHASH function.

FIG. 9 illustrates a diagrammatic representation of a computing system 1000 which may incorporate the processing device described herein and within which a set of instructions, for causing the computing device to perform the methods described herein, may be executed. Computing system 1000 may be connected to other computing devices in a LAN, an intranet, an extranet, and/or the Internet. The computing device may operate in the capacity of a server machine in client-server network environment. The computing device may be provided by a personal computer (PC), a set-top box (STB), a server, a network router, switch or bridge, or any machine capable of executing a set of instructions (sequential or otherwise) that specify actions to be taken by that machine. Further, while only a single computing device is illustrated, the term “computing device” shall also be taken to include any collection of computing devices that individually or jointly execute a set (or multiple sets) of instructions to perform the methods described herein.

The example computing system 1000 may include a processing device 1002, which in various illustrative examples may be a general purpose or specialized processor comprising one or more processing cores. The example computing system 1000 may further comprise a main memory 1004 (e.g., synchronous dynamic random access memory (DRAM), read-only memory (ROM)), a static memory 1006 (e.g., flash memory and a data storage device 1018), which may communicate with each other via a bus 1030.

The processing device 1002 may be configured to execute methods 600-800 for computing hash functions in a manner resistant to external monitoring attacks, in accordance with one or more aspects of the present disclosure for performing the operations and steps described herein.

The example computing system 1000 may further include a network interface device 1008 which may communicate with a network 1020. The example computing system 1000 also may include a video display unit 1010 (e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)), an alphanumeric input device 1012 (e.g., a keyboard), a cursor control device 1014 (e.g., a mouse) and an acoustic signal generation device 1016 (e.g., a speaker). In one embodiment, the video display unit 1010, the alphanumeric input device 1012, and the cursor control device 1014 may be combined into a single component or device (e.g., an LCD touch screen).

The data storage device 1018 may include a computer-readable storage medium 1028 on which may be stored one or more sets of instructions (e.g., instructions of methods 600-800) implementing any one or more of the methods or functions described herein. Instructions implementing methods 600-800 may also reside, completely or at least partially, within the main memory 1004 and/or within the processing device 1002 during execution thereof by the example computing system 1000, hence the main memory 1004 and the processing device 1002 may also constitute or comprise computer-readable media. The instructions may further be transmitted or received over the network 1020 via the network interface device 1008.

While the computer-readable storage medium 1028 is shown in an illustrative example to be a single medium, the term “computer-readable storage medium” should be taken to include a single medium or multiple media (e.g., a centralized or distributed database and/or associated caches and servers) that store the one or more sets of instructions. The term “computer-readable storage medium” shall also be taken to include any medium that is capable of storing, encoding or carrying a set of instructions for execution by the machine and that cause the machine to perform the methods described herein. The term “computer-readable storage medium” shall accordingly be taken to include, but not be limited to, solid-state memories, optical media and magnetic media.

Unless specifically stated otherwise, terms such as “updating”, “identifying”, “determining”, “sending”, “assigning”, or the like, refer to actions and processes performed or implemented by computing devices that manipulates and transforms data represented as physical (electronic) quantities within the computing device's registers and memories into other data similarly represented as physical quantities within the computing device memories or registers or other such information storage, transmission or display devices. Also, the terms “first,” “second,” “third,” “fourth,” etc. as used herein are meant as labels to distinguish among different elements and may not necessarily have an ordinal meaning according to their numerical designation.

Examples described herein also relate to an apparatus for performing the methods described herein. This apparatus may be specially constructed for the required purposes, or it may comprise a general purpose computing device selectively programmed by a computer program stored in the computing device. Such a computer program may be stored in a computer-readable non-transitory storage medium.

The methods and illustrative examples described herein are not inherently related to any particular computer or other apparatus. Various general purpose systems may be used in accordance with the teachings described herein, or it may prove convenient to construct more specialized apparatus to perform the required method steps. The required structure for a variety of these systems will appear as set forth in the description above.

The above description is intended to be illustrative, and not restrictive. Although the present disclosure has been described with references to specific illustrative examples, it will be recognized that the present disclosure is not limited to the examples described. The scope of the disclosure should be determined with reference to the following claims, along with the full scope of equivalents to which the claims are entitled. 

1-18. (canceled)
 19. A system, comprising: a first multiplier circuit to multiply a hash key by a combination of an input data block and a masked result value to produce a new masked result value, by iteratively processing operand bits starting from a first bit position; a second multiplier circuit to multiply the hash key by a mask correction value to produce a new mask correction value, by iteratively processing operand bits starting from a second bit position, wherein the second bit position is different from the first bit position.
 20. (canceled)
 21. The system of claim 19, wherein the first bit position is represented by one of: a least-significant bit and a most-significant bit.
 22. The system of claim 19, wherein the second bit position is represented by one of: a least-significant bit and a most-significant bit.
 23. The system of claim 19, further comprising: an input interface to receive the input data block and the masked result value.
 24. The system of claim 19, further comprising: an adder circuit to apply the new mask correction value to the new masked result value.
 25. The system of claim 19, wherein the first multiplier circuit and the second multiplier circuit perform multiplication operations in a finite field.
 26. The system of claim 19, wherein the input data block comprises at least one of: a ciphertext block or an additional authentication data (AAD) block.
 27. A system, comprising: a first multiplier circuit to multiply a mask value by a combination of the input data block and the unmasked result value to produce a mask correction value, by iteratively processing operand bits starting from a first bit position; a second multiplier circuit to multiply a masked hash key by a combination of the input data block and the unmasked result value to produce a masked result value, by iteratively processing operand bits starting from a second bit position, wherein the second bit position is different from the first bit position.
 28. The system of claim 27, wherein the first bit position is represented by one of: a least-significant bit and a most-significant bit.
 29. The system of claim 27, wherein the second bit position is represented by one of: a least-significant bit and a most-significant bit.
 30. The system of claim 27, further comprising: an input interface to receive the input data block and the unmasked result value.
 31. The system of claim 27, further comprising: an adder circuit to apply the mask correction value to the masked result value.
 32. The system of claim 27, wherein the first multiplier circuit and the second multiplier circuit perform multiplication operations in a finite field.
 33. The system of claim 27, wherein the input data block comprises at least one of: a ciphertext block or an additional authentication data (AAD) block.
 34. A method, comprising: receiving, by a processing device, an input data block and an iteration result value; performing a first field multiplication operation to produce a new masked result value, by iteratively processing operand bits starting from a first bit position; performing a second field multiplication operation to produce a new mask correction value, by iteratively processing operand bits starting from a second bit position; producing an unmasked result value by applying the new mask correction value to the new masked result value; and producing, based on the unmasked result value, a value of a cryptographic hash function.
 35. The method of claim 34, further comprising: utilizing the value of the cryptographic hash function by at least one of: an authenticated encryption operation or an authenticated decryption operation.
 36. The method of claim 34, wherein the receiving and multiplying operations are performed iteratively, such that the new iteration result value of a current iteration is supplied to a next iteration as the iteration result value.
 37. The method of claim 34, wherein the receiving and multiplying operations are performed iteratively, such that the new mask correction value of a current iteration is supplied to a next iteration as a mask correction value.
 38. The method of claim 34, wherein performing the first field multiplication operation comprises: multiplying a hash key by the combination of the input data block and a masked iteration result value.
 39. The method of claim 34, wherein performing the second field multiplication operation comprises: multiplying a hash key by a mask correction value. 